<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Hoarding extends Model
{
    protected $table='hoarding_tickets';
    protected $guarded=[];
    public $timestamps=false;

    //新增或修改
    public static function addOrUpdate($id,$discount_price,$discount_ratio,$ticket_total,$days,$is_over,$start_time,$end_time){
        if(!$id){
            return Hoarding::insert(['discount_price'=>$discount_price,'discount_ratio'=>$discount_ratio,'ticket_total'=>$ticket_total,'days'=>$days,'is_over'=>$is_over,'start_time'=>$start_time,'end_time'=>$end_time]);
        }else{
            return Hoarding::where(['id'=>$id])->update(['discount_price'=>$discount_price,'discount_ratio'=>$discount_ratio,'ticket_total'=>$ticket_total,'days'=>$days,'is_over'=>$is_over,'start_time'=>$start_time,'end_time'=>$end_time]);
        }

    }

    //查询
    public static function store($id){
        return Hoarding::find($id);
    }
}
